Hybrid processing of OpenGL display list commands

ABSTRACT

A hybrid method or apparatus for processing OpenGL display list commands. A deamon intercepts display list commands issued by a client to an OpenGL stack. Responsive to a newList [list commands] endList sequence: the daemon stores a representation of a first subset of the list commands; and creates, in the stack, a display list corresponding to a second subset of the list commands. Responsive to a callList command: the daemon issues to the stack at least one immediate mode command corresponding to the first subset of the list commands and at least one callList command invoking the display list corresponding to the second subset of the list commands. The daemon may also store a representation of an expression or function. Responsive to the callList command, the daemon may evaluate the expression or function and conditionally change the step of invoking the display list based on the outcome.

FIELD OF THE INVENTION

This invention relates generally to computer graphics, and moreparticularly to methods and apparatus for processing OpenGL displaylists.

BACKGROUND

The graphics standard known as “OpenGL” defines a software interface forcontrolling graphics display systems. More specifically, it defines anumber of commands that may be issued by client software to cause anOpenGL-compliant graphics system to draw. Some OpenGL commands aredesigned to place the graphics system into a particular state (e.g., setthe current color to a particular color, or set the current model viewmatrix to a certain value). Other commands are designed to specifyprimitives for rendering (e.g., define the vertices of a triangle orother polygon).

It is common for client software to issue OpenGL commands in what iscalled immediate mode so that the commands will be executed upon receiptby the graphics system. But OpenGL also includes a notion of displaylists. A display list represents a set of one or more commands. Oncecreated, a display list is stored for possible later or repeatedinvocation by client software. For example, a display list might becreated for rendering a wheel and then invoked four times to draw thefour wheels of a car. For further background information on OpenGL andOpenGL display lists, see for example OpenGL Programming Guide(Addison-Wesley, 1993).

In practice, an OpenGL implementation is often provided in the form of a“stack” that includes an OpenGL library, one or more device drivers, anda hardware subsystem for accelerating rendering operations and driving adisplay device. An application or client may utilize the functionalityexposed by an OpenGL stack by issuing OpenGL commands or function callsto the stack. This may be done locally in cases where the application isexecuting on the same host as the stack. Or this may be done remotely incases where the application is executing on a first host while theOpenGL stack and display hardware are resident on a second hostnetworked to the first host. Although many different commerciallyavailable stacks are OpenGL compliant, performance and extra featuresvary from one vendor's stack to another's.

SUMMARY OF THE INVENTION

According to a preferred embodiment, the invention includes a hybridmethod or apparatus for processing OpenGL display list commands issuedby a client. A daemon and an OpenGL stack are provided. The deamonintercepts display list commands issued by the client to the stack.Responsive to an intercepted newList [list commands] endList commandsequence: the daemon stores a representation of a first subset of thelist commands; and creates, in the stack, a display list correspondingto a second subset of the list commands. Responsive to an interceptedcallList command: the daemon issues to the stack at least one immediatemode command corresponding to the first subset of the list commands andat least one callList command invoking the display list corresponding tothe second subset of the list commands. The invention is hybrid innature because part of the application's display list is stored in thedaemon, while another part of the list is stored in the OpenGL stack.The hybrid nature of the invention makes it possible to addfunctionality to an off-the-shelf OpenGL stack without altering thestack in any way. Moreover, good performance is maintained.

For example, in a further aspect of the invention, the daemon may,responsive to the intercepted newList [list commands] endList commandsequence, store a representation of an expression or function; and,responsive to the intercepted callList command, evaluate the expressionor function and conditionally change the step of invoking the displaylist based on the outcome of evaluating the expression or function.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram illustrating a prior art arrangement wherein aclient software system issues OpenGL commands to an OpenGL stack.

FIG. 2 is a block diagram illustrating a first preferred embodiment ofthe invention wherein a daemon intercepts display list commands issuedby a client software system.

FIG. 3 is a block diagram illustrating a second preferred embodiment ofthe invention wherein a daemon intercepts display list commands issuedby a client software system.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

FIG. 1 illustrates a prior art arrangement wherein a client softwaresystem 100 issues OpenGL commands 102 to an OpenGL stack 104. A typicalOpenGL stack might include an OpenGL library such as libGL 106, one ormore device drivers 108, and display hardware 110. Client system 100 andstack 104 may reside in the same host computer (in a localconfiguration), or they may reside in separate host computers networkedtogether (in a remote configuration). In a local configuration, atypical client system 100 might include application software. In aremote configuration, client system 100 might additionally include aclient-side OpenGL implementation which in turn would forward OpenGLcommands issued by application software to remote stack 104 using thenetwork.

The OpenGL commands 102 shown in FIG. 1 are intended to exemplify, forpurposes of illustration, a typical sequence of display list commandsthat might be issued to an OpenGL stack by a client software system. Forthe sake of clarity, the notation shown in the drawing is pseudo-codeonly, not syntactically detailed OpenGL. To create a display list,client system 100 would normally issue a newList [list commands] endListsequence as shown in the drawing at blocks 112, 114, 116. When issuingnewList command 112, client system 100 specifies an id to be associatedwith the newly created list. Then client system issues a series of listcommands 114 that it wants included in the new display list. In theexample shown in FIG. 1, list commands 114 include state command A, drawarray 1, state command B, draw array 2, state command c, and draw array3. Finally, client system 100 issues endList command 116 to signal theend of list commands 114 and to cause stack 104 to process and store thenew list 118 for later invocation. When client system 100 desires forstack 104 to execute the new display list, it issues callList command120, specifying the previously-given id as an argument. Upon receipt ofcallList command 120, stack 104 executes the list 118 that correspondsto the specified id.

Hybrid Processing of Display List Commands. FIG. 2 illustrates a firstpreferred embodiment of the invention wherein a daemon 200 interceptsdisplay list commands 102 issued by client software system 100. Tocreate a display list for later invocation, client system 100 issues thesame sequence of commands as in the previous example. Also as before,client system 100 issues callList command 120 25 (specifying the listid) when it desires to have the newly created list executed. In theconfiguration of FIG. 2, however, commands 102 are not executed directlyby stack 104. Instead, they are intercepted by daemon 200 as shown.

Responsive to newList [list commands] endList command sequence 102,daemon 200 stores a representation of a subset of list commands 114,such as state commands A, B and C, as shown in the drawing at 202.Preferably, command representations 202 are stored in the daemon and areassociated with the list id 204 that was specified by client system 100when it issued newList command 112. In addition to storing commandrepresentations 202, daemon 200 also creates one or more display listsin stack 104. These latter display lists correspond to another subset oflist commands 114, such as draw arrays 1, 2 and 3. In the example ofFIG. 2, daemon 200 might accomplish this by issuing three newList [listcommands] endList command sequences to stack 104 to create lists 1, 2and 3 in stack 104 as shown at 206, 208, 210.

When client system 100 desires to have its newly created list executed,it issues callList command 120. In response, daemon 200 may issueimmediate mode commands to stack 104. The immediate mode commands soissued would correspond to the commands represented at 202. In addition,daemon 200 may issue one or more callList commands to stack 104. ThecallList commands so issued would correspond to the display lists 206,208 and/or 210 that were previously created by daemon 200. Thus theclient's display list is executed, but in a hybrid fashion wherein aportion of the list is stored in daemon 200 and another portion isstored in stack 104.

Addition of Bounding Volume Functionality. The hybrid nature of theinventive apparatus and method makes it possible to add functionality toan off-the-shelf OpenGL stack without altering the stack in any way,while still retaining good performance. For example, the embodimentshown in FIG. 2 illustrates a preferred technique for adding boundingvolume functionality to display lists in cases where such functionalityis not provided by stack 104.

By way of background, bounding volumes are a known performanceenhancement technique in computer graphics. A simple shape such as acube may be defined to enclose a more complex shape such as a star. Insuch an example the cube would be referred to as the bounding volume forthe star. During rendering, the coordinates defining the cube arecompared with the coordinates defining a viewing volume. If the cube isoutside the viewing volume, then the star is not rendered; otherwise,the star is rendered. It is computationally simpler to compare theviewing volume with a simple shape such as the cube than it is tocompare it with a complex shape such as the star. Consequently, the useof bounding volumes helps to conserve resources and improve performance.

Referring again to FIG. 2, daemon 200 may automatically generatebounding volumes corresponding to geometry elements contained in listcommands 114. Specifically, responsive to newList [list commands]endList sequence 102, daemon 200 may determine bounding volumes for thegeometry elements indicated by draw arrays 1, 2 and 3. Known techniquesmay be used to determine the bounding volumes. For example, the extremaof the x, y and z coordinates corresponding to draw array 1 may be usedto define a rectangular bounding volume for draw array 1. The sametechnique may be employed to define a bounding volume for draw array 2,and for draw array 3. (It should be noted that, although draw arrays areshown in the example, any technique or command may be used to specifygeometric primitives in list commands 114. Bounding volumes may becomputed on a primitive-by-primitive basis regardless of the form inwhich the primitives are specified.) Daemon 200 then inserts one or moreexpressions or functions into command representations 202 so that thebounding volumes so computed may be used when the client's display listis invoked.

When client system 100 issues callList command 120 to invoke its displaylist, daemon 200 may then evaluate the expressions or functions and,depending on the value computed, change its behavior regardinginvocation of display lists 206, 208 and 210. In the example of FIG. 2,the expressions or functions are illustrated generically by the three“if” statements in command representations 202. For a primitive whosebounding volume intersects the viewing volume (e.g., if(bVol1 Test( )),then daemon 200 may issue a callList command to stack 104 in order torender that primitive (e.g., callList(1)). But for a primitive whosebounding volume does not intersect the viewing volume, then daemon 200may suppress the callList command and simply move on to the next line incommand representations 202. Other visibility indicators (includingthose derived by means other than bounding volume tests) may also beused to determine whether or not to invoke one of display lists 206, 208or 210.

Addition of LOD Functionality. Another application of hybrid displaylist processing is to add level of detail (LOD) functionality where suchfunctionality is not provided by stack 104. Such an application isillustrated in FIG. 3. As in the previous examples, client system 100issues a newList [list commands] endList sequence 300 in order to createa new display list having a client-specified id. Sequence 300 mightinclude newList command 302, list commands 304, and endList command 306.

Responsive to sequence 300, daemon 200 may create several display listsin stack 104. For example, daemon 200 may store the small draw array incommand representations 308 in order to conserve the overhead ofcreating and calling a display list. But on the other hand, daemon 200may create display list 310 in stack 104, which display list correspondsto the large draw array. (The overhead of creating and invoking displaylist 310 will generally be cost effective for computationally intensiveprimitives or geometries.)

When daemon 200 encounters the car geometry specified in list commands300, it may create numerous display lists in stack 104 to represent thesame geometry at different levels of detail. In the example, daemon 200creates three such lists: List 312 represents the car geometry at a lowlevel of detail or resolution. List 314 represents the car geometry at amedium level of detail or resolution. And list 316 represents the cargeometry at a high level of detail or resolution. In addition, daemon200 may insert an expression or function into command representations308. One technique for doing so is indicated generically in the drawingby the assignment statement “i=lodSelect(list5, list6, list7).”

When client system 100 issues callList command 320 to have its displaylist executed, daemon 200 may parse through its command representations308 as in the previous examples, issuing immediate mode OpenGL commandsto stack 104 in order to execute the corresponding commands. But in thiscase, daemon 200 will automatically determine an appropriate level ofdetail prior to rendering the car geometry, and will issue a callListcommand to stack 104 to invoke the one car geometry display list thatcorresponds to the desired level of detail. Specifically, daemon 200will evaluate the function lodSelect to determine an id or level ofdetail indicator for one of the three lists 312, 314 or 316. It willthen specify the corresponding id when it issues the callList command(“callList(i)”) shown at the end of command representations 308.

Persons having ordinary skill in the art will appreciate that theabove-described invention may be implemented in hardware logic or insoftware logic, or both. In addition, daemon 200 may be implemented in avariety of ways as appropriate given the configuration into which it isdeployed. For example, daemon 200 may be implemented using a stand-aloneprocess, or it may constitute one or more threads of an existingprocess, and/or it may be implemented as part of a library.

1. A method for processing OpenGL display list commands issued by aclient, comprising: providing a daemon and an OpenGL stack; interceptingdisplay list commands issued by the client to the stack; responsive toan intercepted newList, endList command sequence: storing, in thedaemon, a representation of a first subset of the list commands; andcreating, in the stack, a display list corresponding to a second subsetof the list commands; and responsive to an intercepted callList command,causing the daemon to issue to the stack: at least one immediate modecommand corresponding to the first subset of the list commands; and atleast one callList command invoking the display list corresponding tothe second subset of the list commands.
 2. The method of claim 1,further comprising: responsive to the intercepted newList, endListcommand sequence: storing, in the daemon, a representation of anexpression or function; and responsive to the intercepted callListcommand, causing the daemon to: evaluate the expression or function; anddepending on the value of the expression or function, conditionallychange the step of invoking the display list.
 3. The method of claim 2,wherein: creating the display list comprises creating plural displaylists corresponding to different levels of detail; evaluating theexpression or function yields a level of detail indicator; andconditionally changing the step of invoking the display list comprisesinvoking, from among the plural display lists, the one display listwhose level of detail corresponds to the level of detail indicator. 4.The method of claim 2, wherein: evaluating the expression or functionyields a visibility indicator; and conditionally changing the step ofinvoking the display list comprises invoking or not invoking the displaylist depending on the value of the visibility indicator.
 5. The methodof claim 4, wherein: the visibility indicator represents whether apre-defined bounding volume intersects a viewing volume.
 6. Apparatusfor processing OpenGL display list commands issued by a client,comprising: daemon logic and an OpenGL stack; means for interceptingdisplay list commands issued by the client to the stack; means forresponding to an intercepted newList, endList command sequence,comprising: means for storing, in the daemon, a representation of afirst subset of the list commands; and means for creating, in the stack,a display list corresponding to a second subset of the list commands;and means for responding to an intercepted callList command by causingthe daemon to issue to the stack: at least one immediate mode commandcorresponding to the first subset of the list commands; and at least onecallList command invoking the display list corresponding to the secondsubset of the list commands.
 7. The apparatus of claim 6, furthercomprising: means for responding to the intercepted newList, endListcommand sequence by storing, in the daemon, a representation of anexpression or function; and means for responding to the interceptedcallList command comprising: means for evaluating the expression orfunction; and means for, depending on the value of the expression orfunction, conditionally changing the step of invoking the display list.8. The apparatus of claim 7, wherein: the means for creating the displaylist comprises means for creating plural display lists corresponding todifferent levels of detail; the means for evaluating the expression orfunction yields a level of detail indicator; and wherein conditionallychanging the step of invoking the display list comprises invoking, fromamong the plural display lists, the one display list whose level ofdetail corresponds to the level of detail indicator.
 9. The apparatus ofclaim 7, wherein: the means for evaluating the expression or functionyields a visibility indicator; and wherein conditionally changing thestep of invoking the display list comprises invoking or not invoking thedisplay list depending on the value of the visibility indicator.
 10. Theapparatus of claim 9, wherein: the visibility indicator representswhether a pre-defined bounding volume intersects a viewing volume.
 11. Astorage medium comprising program code embodied in a storage mediumwhich, when executed by one or more processing devices, implements amethod for processing OpenGL display list commands issued by a client,the method comprising: providing a daemon and an OpenGL stack;intercepting display list commands issued by the client to the stack;responsive to an intercepted newList, endList command sequence: storing,in the daemon, a representation of a first subset of the list commands;and creating, in the stack, a display list corresponding to a secondsubset of the list commands; and responsive to an intercepted callListcommand, causing the daemon to issue to the stack: at least oneimmediate mode command corresponding to the first subset of the listcommands; and at least one callList command invoking the display listcorresponding to the second subset of the list commands.
 12. The storagemedium of claim 11, wherein the method further comprises: responsive tothe intercepted newList, endList command sequence: storing, in thedaemon, a representation of an expression or function; and responsive tothe intercepted callList command, causing the daemon to: evaluate theexpression or function; and depending on the value of the expression orfunction, conditionally change the step of invoking the display list.13. The storage medium of claim 12, wherein: creating the display listcomprises creating plural display lists corresponding to differentlevels of detail; evaluating the expression or function yields a levelof detail indicator; and conditionally changing the step of invoking thedisplay list comprises invoking, from among the plural display lists,the one display list whose level of detail corresponds to the level ofdetail indicator.
 14. The storage medium of claim 12, wherein:evaluating the expression or function yields a visibility indicator; andconditionally changing the step of invoking the display list comprisesinvoking or not invoking the display list depending on the value of thevisibility indicator.
 15. The storage medium of claim 14, wherein: thevisibility indicator represents whether a pre-defined bounding volumeintersects a viewing volume.